package br.com.projetos.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import br.com.projetos.entity.Nomeado;
import br.com.projetos.entity.RequerimentoAuxilioTransporte;

public class RequerimentoAuxilioTransporteDAO extends DAO {

	private static RequerimentoAuxilioTransporteDAO instance;

	private RequerimentoAuxilioTransporteDAO() {
	}

	public static RequerimentoAuxilioTransporteDAO getInstance() {
		if (instance == null) {
			instance = new RequerimentoAuxilioTransporteDAO();
		}
		return instance;
	}

	@SuppressWarnings("unchecked")
	public List<RequerimentoAuxilioTransporte> buscaRequerimentoAuxilioByNomeado(
			Nomeado nomeado) {
		HibernateUtility.beginTransaction();
		Criteria c = HibernateUtility.getSession().createCriteria(
				RequerimentoAuxilioTransporte.class);
		c.add(Restrictions.eq("nomeado", nomeado));
		c.add(Restrictions.eq("indTransporte", true));
		HibernateUtility.commitTransaction();
		return c.list();
	}

}